#include <stdio.h>
#include "stack.h"

int main(void)
{
    int stack_cnt = 8;
    struct stack * p_stack = stack_create(stack_cnt); 
    /*写了申请内存，后面就要写释放内存的*/ /*整个过程中，都没有调用stack的数据成员 */
    if(p_stack == NULL) {
        return -1;
    }
    int i = 0;
    int s32Ret = 0;
    int s32Value = 0; 

    for(i = 0; i < stack_cnt; i++) {
        s32Ret = stack_push(p_stack, i);
        if(s32Ret) {
            printf("error:[%d]\n", s32Ret);
        }
    }

    for(i = 0; i < stack_cnt; i++) {
        s32Ret = stack_pop(p_stack,&s32Value);
        if(s32Ret) {
            printf("error:[%d]\n", s32Ret);
        }else {
            printf("[%d]:[%d]\n", i, s32Value);
        }
    }

    stack_delete(p_stack);

    return 0;
}
